<?php
namespace app\home\model;

use think\Model;

class Gift extends Model
{
   protected $table = 'rd_home_gifts';
    /**
     * 显示列表.
     *
     * @return \think\Response
     */
    public  function lists(){
        //
        $where['status'] = 1;
        $lists = Gift::where($where)
            ->field('id giftid,giftname,cost,giftpics')
            ->order('create_time desc')
            ->select();
       if (!empty($lists)){
           foreach ($lists as $k=>$v){
                 if (strpos($v['giftpics'],$_SERVER['HTTP_HOST']) == false){
                     $lists[$k]['giftpics'] = 'http://'.$_SERVER['HTTP_HOST'].$v['giftpics'];
                 }
           }
           return $lists;
       }else{
           return false;
       }
    }
}